package com.wxtl.action;

import java.util.ArrayList;
import java.util.List;

import com.wxtl.action.base.BaseAction;
import com.wxtl.entity.Content;
import com.wxtl.service.ContentService;
import com.wxtl.util.Page;

public class ContentAction extends BaseAction {
	private Content content =new Content();
	private int[] ids;
	
	private List<Content> clist = new ArrayList<Content>();

	public List<Content> getClist() {
		return clist;
	}

	public void setClist(List<Content> clist) {
		this.clist = clist;
	}

	private ContentService contentService;
	
	public Content getContent() {
		return content;
	}

	public void setContent(Content content) {
		this.content = content;
	}

	public int[] getIds() {
		return ids;
	}

	public void setIds(int[] ids) {
		this.ids = ids;
	}

	public ContentService getContentService() {
		return contentService;
	}

	public void setContentService(ContentService contentService) {
		this.contentService = contentService;
	}

	public String add(){
		contentService.add(content);
		return SUCCESS;
	}
	
	public String update(){
		contentService.update(content);
		return SUCCESS;
	}
	
	public String delete(){
		contentService.delete(ids);
		return SUCCESS;
	}
	
	public String query(){
		Page pageData=contentService.query(super.getDataGrid(),content);
		setPageData(pageData);
		return SUCCESS;
	}
	
	public String queryAllContent(){
		setClist(contentService.queryAllContent());
		return SUCCESS;
	}
}
